<?php
    include('../function/checkAdminAccess.php');
    $iniVars = parse_ini_file('../../config.ini',TRUE);
    include('../../classes/adodb5/adodb.inc.php');
    include('../../function/db.func.php');
    
    $psId = $_GET['psid'];
    $sql = "SELECT song_img,song_youtube,song_active FROM songs WHERE song_id=$psId";
    $result = $db->Execute($sql);
    
    if($result->fields['song_active']==1){
        $radioActive = ' checked="checked"';
        $radioUnActive = '';
    }else{
        $radioActive = '';
        $radioUnActive = ' checked="checked"';
    }
?>
<script type="text/javascript">
    $(document).ready(function(){
        
        $('.button').click(function(){
            if(trim($('#prideMsg').val())=='')
            {
                alert('กรุณากรอกข้อความ');
            }
            else
            {
                $('#prideStudentAddFrm').submit();
            }
        });
        
    });
    
</script>
<form name="prideStudentAddFrm" id="prideStudentAddFrm" target="ajaxIfrm" method="post" action='function/songsEdit.php' enctype='multipart/form-data'>
    <p id="prideStudentAddFrmImg">
        <label>Image : </label>
        <img src="<?php echo $iniVars['Locations']['siteurl'],$result->fields['song_img']; ?>" />
        <input type="file" name="prideImg" id="prideImg" />
    </p>
    <p id="prideStudentAddFrmMsg">
        <label>Youtube url : </label>
        <textarea name="prideMsg" id="prideMsg" cols="50" rows="2" class="styled_textarea wysiwyg"><?php echo $result->fields['song_youtube']; ?></textarea>
    </p>
    <p id="prideStudentAddFrmMsg">
        <input type="radio" name="prideActive" value="1" <?php echo $radioActive; ?>/> Show
        &nbsp;&nbsp;&nbsp;&nbsp;<input type="radio" name="prideActive" value="2" <?php echo $radioUnActive; ?>/> Hide
    </p>
    <input type="button" class="button" value="Save" />
    <input type="hidden" name="psId" value="<?php echo $psId; ?>" />
    &nbsp;<img src="images/ajax-loader.gif" class="ajax_load_img submit_indicator"/>
</form>
<div class="information canhide png_bg">รูปภาพขนาดแนะนำคือ 255x165 pixel</div>
<div class="fail canhide png_bg ajax_msg" id="error_msg"></div>
<div class="success canhide ajax_msg" id="success_msg"><p></p></div>
<iframe name="ajaxIfrm" class="ajaxIfrm" style="width:0;height:0;display:none;" ></iframe>